#include "kppch.h"
#include "primitive.h"

namespace kp {
    bool GeometryPrimitive::Intersect(const Ray& r, Intersection& rec) const {
		SdfRecordType sdfRecT;
		float thit, epsilon;
		if (shape->Intersect(r, thit, epsilon, rec, sdfRecT)) {
			r.maxt = thit;
			rec.primitive = this;
			rec.shape = this->shape.get();
			rec.material = this->material.get();
			return true;
		}
		return false;
	}
	void GeometryPrimitive::ComputeScatteringFunctions(Intersection* si,
		TransportMode mode, bool allowMultipleLobes) const {
		if (material)
			material->ComputeScatteringFunctions(si, mode, allowMultipleLobes);
	}
}